/**
 * Description: RegisterInfoTypeServiceImpl.java
 * Copyright (c) 2008-2009  Neo. 
 * All Rights Reserved.
 * @version 1.0  Apr 2, 2009 2:36:02 PM 李萌（neolimeng@gmail.com）created
 */
package org.paradise.dms.services.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.paradise.dms.dao.impl.RegisterInfoTypeDAOImpl;
import org.paradise.dms.pojo.RegisterInfoType;
import org.paradise.dms.services.RegisterInfoTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * Description: Copyright (c) 2008-2009 Neo. All Rights Reserved.
 * 
 * @version 1.0 Apr 2, 2009 2:36:02 PM 李萌（neolimeng@gmail.com）created
 */
@Service
public class RegisterInfoTypeServiceImpl implements RegisterInfoTypeService {
	private static Logger log = Logger
			.getLogger(RegisterInfoTypeServiceImpl.class);
	@Autowired
	@Qualifier("registerInfoTypeDAOImpl")
	private RegisterInfoTypeDAOImpl registerInfoTypeDapImpl;
	List<RegisterInfoType> lrit;

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterInfoTypeService#deleteRegisterInfoType(int)
	 */
	public boolean deleteRegisterInfoType(int registerinfotypeid) {
		try {
			this.registerInfoTypeDapImpl
					.deleteRegisterInfoType(registerinfotypeid);
			return true;
		} catch (Exception e) {
			log.error("Service-删除物品类型时出错！！");
			e.printStackTrace();
			return false;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterInfoTypeService#getAllRegisterInfoType()
	 */
	public List<RegisterInfoType> getAllRegisterInfoType() {
		try {
			lrit = this.registerInfoTypeDapImpl.getAllRegisterInfoType();
			log.info("DMS_info_取得所有外借物品登记类型，成功！！共有 " + lrit.size() + " 条信息。");
			return lrit;
		} catch (Exception e) {
			log.error("DMS_error_Service-取得所有物品类型时出错!!");
			e.printStackTrace();
			return null;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterInfoTypeService#getRegisterInfoTypeById(int)
	 */
	public RegisterInfoType getRegisterInfoTypeById(int registerinfotypeid) {
		try {
			return this.registerInfoTypeDapImpl
					.getRegisterInfoType(registerinfotypeid);
		} catch (Exception e) {
			log.error("Service-根据公告ID取得物品类型时出错!!");
			e.printStackTrace();
			return null;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterInfoTypeService#insertRegisterInfoType(org.paradise.dms.pojo.RegisterInfoType)
	 */
	public boolean insertRegisterInfoType(RegisterInfoType rit) {
		try {
			this.registerInfoTypeDapImpl.insertRegisterInfoType(rit);
			return true;
		} catch (Exception e) {
			log.error("Service-插入物品类型时出错!!");
			e.printStackTrace();
			return false;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterInfoTypeService#updateRegisterInfoType(org.paradise.dms.pojo.RegisterInfoType)
	 */
	public boolean updateRegisterInfoType(RegisterInfoType rit) {
		try {
			this.registerInfoTypeDapImpl.updateRegisterInfoType(rit);
			return true;
		} catch (Exception e) {
			log.error("Service-更新物品类型时出错!!");
			e.printStackTrace();
			return false;
		}
	}

	/**
	 * @return the registerInfoTypeDapImpl
	 */
	public RegisterInfoTypeDAOImpl getRegisterInfoTypeDapImpl() {
		return registerInfoTypeDapImpl;
	}

	/**
	 * @param registerInfoTypeDapImpl
	 *            the registerInfoTypeDapImpl to set
	 */
	public void setRegisterInfoTypeDapImpl(
			RegisterInfoTypeDAOImpl registerInfoTypeDapImpl) {
		this.registerInfoTypeDapImpl = registerInfoTypeDapImpl;
	}

	public List<RegisterInfoType> getLrit() {
		return lrit;
	}

	public void setLrit(List<RegisterInfoType> lrit) {
		this.lrit = lrit;
	}

}
